package com.fishbone.file.config;

import com.fishbone.file.fast.FastDFSClient;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName ObsAutoConfiguration
 * @Author huyaxi
 * @DATE 2020/6/28 12:08
 */
@Configuration
@EnableConfigurationProperties(FastProperties.class)
public class FastAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean(FastDFSClient.class)
    @ConditionalOnProperty(prefix = "fast",value = "enabled",havingValue = "true",matchIfMissing = true)
    FastDFSClient fastDFSClient(FastProperties properties) {
        return new FastDFSClient(properties);
    }
}
